 define(['app'], function (app) {
    app.controller('SscsCtrl', ['$scope', 'DataService', 'UtilFactory', '$http', '$location', function ($scope, DataService, UtilFactory, $http, $location) {


    	$scope.tabbardj($scope.navBtns, 1);
    	// console.log(qiehuan);
    	

    	// 使用$http发起网络请求
        $http({
            method: 'GET',
            url: '../../aixianfeng/data/data.json'
        }).then(function (res) {
            $scope.data = res.data.data;

            // console.log($scope.data);
            $scope.data1 = res.data.data.products[104749];
        });

        $scope.qiehuan =function (btns, index) {
        	console.log(index);
    		$scope.id = $scope.data.categories[index].id;  
    		$scope.data1 =$scope.data.products[$scope.id];	
    		for (var i = 0; i < btns.length; i++) {
    			if (i==index) {
    				btns[i].is_open = 0;
    			}else{
    				btns[i].is_open = 1;
    			}
    		}
    // $scope.qiehuan($scope.dataul, 0);
        }


        $scope.add = function () {
        	console.log(1);
            console.log(this.index);

            DataService.addItem(this.index);
            console.log(DataService.getAllGoods());
        };

        // $scope.reduce = function () {
        // 	DataService.reduce(this.index);
        // }



    $scope.reduce = function (index) {
        // console.log(this.index);
        DataService.sscsjian(index);
        console.log(DataService.getAllGoods());
    };

    // $scope.add = function () {
    //     var a = $scope.goods[this.$index];
    //     console.log(a);

    //     a.count++;

    //     $scope.allPrice = UtilFactory.money();
    // };
    //点击加时进行数量加加
     // $scope.jia = function(){
     //    this.count++;

     //    // console.log(this.count);
     // };
     // //点击减时进行数量减减
     // $scope.jian = function(){
     //    if(this.count>0){
     //        this.count--;
     //    }
     // };
}])
})
